﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Client.model
{
    [Serializable]
    public class User : INotifyPropertyChanged
    {
        int id;
        string name;
        int age;
        bool sex;
        string address;
        string tel;
        bool exp;
        string note;

        internal void copyData(User srcUser)
        {
            Id=srcUser.id ;
            Name= srcUser.name;
            Age = srcUser.age;
            Sex=srcUser.sex;
            address=srcUser.address;
            Tel=srcUser.tel ;
            Exp = srcUser.exp;
            Note=srcUser.note;
        }

        internal User Clone()
        {
            User user = new User();
            user.id = id;
            user.name = name;
            user.age = age;
            user.sex = sex;
            user.address = address;
            user.tel = tel;
            user.exp = exp;
            user.note = note;

            return user;
        }

        internal void empty()
        {
            Id = 0;
            Name = "";
            Age = 0;
            Address = "";
            Tel = "";
            Note = "";
        }

        public int Id
        {
            get { return id; }
            set { id = value; NotifyPropertyChanged("Id"); }
        }

        public string Name
        {
            get { return name; }
            set { name = value; NotifyPropertyChanged("Name"); } 
        }

        public int Age
        {
            get { return age; }
            set { age = value; NotifyPropertyChanged("Age"); } 
        }

        public bool Sex
        {
            get { return sex; }
            set { sex = value; NotifyPropertyChanged("Sex"); } 
        }

        public string Address
        {
            get { return address; }
            set { address = value; NotifyPropertyChanged("Address"); } 
        }

        public string Tel
        {
            get { return tel; }
            set { tel = value; NotifyPropertyChanged("Tel"); } 
        }

        public bool Exp
        {
            get { return exp; }
            set { exp = value; NotifyPropertyChanged("Exp"); } 
        }

        public string Note
        {
            get { return note; }
            set { note = value; NotifyPropertyChanged("Note"); }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
